home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / tk / tkkey.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-17  |  2.5 KB  |  79 lines

  1. /* Midnight Commander Tk initialization.
  2.    Copyright (C) 1995 Miguel de Icaza
  3.    Copyright (C) 1995 Jakub Jelinek
  4.    
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2 of the License, or
  8.    (at your option) any later version.
  9.    
  10.    This program is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.    GNU General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #include <config.h>
  20. #include "tkmain.h"
  21. #include "tty.h"    /* If you wonder why, read the comment below */
  22. #include "key.h"
  23.  
  24. /* The tty.h file is included since we try to use as much object code
  25.  * from the curses distribution as possible so we need to send back
  26.  * the same constants that the code expects on the non-X version
  27.  * of the code.  The constants may be the ones from curses/ncurses
  28.  * or our macro definitions for slang
  29.  */
  30.  
  31. /* Describes the key code and the keysym name returned by X 
  32.  * In case we found many keyboard problems with the Fnn keys
  33.  * we can allways remove them and put them on the mc.tcl file
  34.  * as local bindings
  35.  */
  36. static key_code_name_t x_keys [] = {
  37.     { KEY_LEFT,      "Left" },
  38.     { KEY_RIGHT,     "Right" },
  39.     { KEY_UP,        "Up" },
  40.     { KEY_DOWN,      "Down" },
  41.     { KEY_END,       "End" },
  42.     { KEY_END,       "R13" },
  43.     { KEY_HOME,      "Home" },
  44.     { KEY_HOME,      "F27" },
  45.     { KEY_PPAGE,     "F29" },
  46.     { KEY_PPAGE,     "Prior" },
  47.     { KEY_NPAGE,     "Next" },
  48.     { KEY_NPAGE,     "F35" },
  49.     { '\n',          "Return" },
  50.     { '\n',          "KP_Enter" },
  51.     { KEY_DC,        "Delete" },
  52.     { KEY_IC,        "Insert" },
  53.     { KEY_BACKSPACE, "BackSpace" },
  54.     { KEY_F(1),      "F1" },
  55.     { KEY_F(2),      "F2" },
  56.     { KEY_F(3),      "F3" },
  57.     { KEY_F(4),      "F4" },
  58.     { KEY_F(5),      "F5" },
  59.     { KEY_F(6),      "F6" },
  60.     { KEY_F(7),      "F7" },
  61.     { KEY_F(8),      "F8" },
  62.     { KEY_F(9),      "F9" },
  63.     { KEY_F(10),     "F10" },
  64.     { 0, 0}            /* terminator */
  65. };
  66.  
  67. int lookup_keysym (char *s)
  68. {
  69.     int i;
  70.     
  71.     for (i = 0; x_keys [i].name; i++){
  72.     if (!strcmp (s, x_keys [i].name))
  73.         return (x_keys [i].code);
  74.     }
  75.     return 0;
  76. }
  77.  
  78.  
  79.